#!/usr/bin/env python
# coding=utf-8
"""
@Author  : youjia - 卞志伟
@file    : main.py
@contact : bianzhiwei@iyoujia.com
@time    : 2019-09-06 09:39 
@Desc    : 
@Software: PyCharm
"""
import os
import sys

# 当前文件的路径
pwd, filename = os.path.split(os.path.abspath(__file__))
# 当前文件的父路径
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + ".")
# 当前文件的前两级目录
grader_father = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(pwd)
sys.path.append(father_path)
sys.path.append(grader_father)

from report_system.other.settlement.service.investor_service import InvestorService
from report_system.other.settlement.models.db_model import InvestRelationRecordModel


class Settlement(object):
    # def __init__(self, invest_id=None):
    #     self._invest_id = invest_id
    # _invest_id: int

    @property
    def invest_id(self):
        return self._invest_id

    @invest_id.setter
    def invest_id(self, value):
        self._invest_id = value

    @invest_id.getter
    def invest_id(self):
        return self._invest_id

    def run(self):
        settlement_service = InvestorService(invest_id=self.invest_id)
        settlement_service.process()


if __name__ == '__main__':
    # invest_ids = InvestRelationRecordModel().get_all_invest_id()
    # print(invest_ids)
    invest_ids = {244049641010656578, 244049662485492996}
    s = Settlement()
    for invest_id in invest_ids:
        s.invest_id = invest_id
        s.run()
